/*---------------------------------------------------------------------
 * File name: hal_timer.h
 *
 * Copyright (c) <2020-2022>, <ChenLong>
 *
 * All rights reserved.
 *
 * Author: ChenLong
 * Email: worldlong@foxmail.com
 *--------------------------------------------------------------------*/
#pragma once
/*
*/
#include "timer.h"
/*
*/
class HAL_Timer : public hal::Timer
{
public:
  HAL_Timer() :
    Timer(),
    _last_micros(nullptr),
    _micros_high(nullptr),
    _index(0)
    {}
  
  bool     init(uint64_t cfg0);
  bool     config(uint64_t cfg0);
  uint64_t micros();
  void     attach_irq(void(*fun)(void *param), void *param);
  
private:
  uint64_t *_last_micros;
  uint64_t *_micros_high;
  uint8_t  _index;
};


